The Essence of Eta-Expansion in Partial Evaluation

نویسندگان

  • Olivier Danvy
  • Karoline Malmkjær
  • Jens Palsberg
چکیده

Selective eta expansion is a powerful binding time improve ment i e a source program modi cation that makes a partial evaluator yield better results But like most binding time improvements the exact problem it solves and the rea son why have not been formalized and are only understood by few In this paper we describe the problem and the e ect of eta redexes in terms of monovariant binding time propa gation eta redexes preserve the static data ow of a source program by interfacing static higher order values in dynamic contexts and dynamic higher order values in static contexts They contribute to two distinct binding time improvements We present two extensions of Gomard s monovariant binding time analysis for the pure calculus Our ex tensions annotate and eta expand terms The rst one eta expands static higher order values in dynamic contexts The second also eta expands dynamic higher order values in static contexts As a signi cant application we show that our rst binding time analysis su ces to reformulate the traditional formulation of a CPS transformation into a modern one pass CPS transformer This binding time improvement is known but it is still left unexplained in contemporary liter ature e g about cps based partial evaluation We also outline the counterpart of eta expansion for par tially static data structures Computer Science Department Ny Munkegade Aarhus C Denmark E mail fdanvy karolineg daimi aau dk College of Computer Science CN Huntington Av enue Boston MA USA E mail palsberg ccs neu edu Introduction Partial evaluation is a program transformation technique for specializing programs In the last decade it has been described using the notion of binding times Essen tially the computations in a source program are divided into static or specialization time computations performed by the partial evaluator and dynamic or run time computa tions to be performed in the specialized program Partial evaluation amounts to performing the static computations and constructing the specialized program so that running it performs the dynamic computations Thus a partial evalu ator evaluates static expressions i e expressions that only depend on partial evaluation time data and reconstructs dynamic expressions i e expressions that depend on run time data For this to work the binding time division must be consistent i e no static computation may depend on the result of a dynamic computation In this setting two sorts of expressible values coexist static values and dynamic values i e residual expressions correspondingly two sorts of contexts coexist as well static contexts and dynamic contexts A context is an expression with one hole A higher order resp partially static context is an expression with a higher order resp partially static hole A static resp dynamic context is an expres sion with a static resp dynamic hole To obtain consis tency Mix style partial evaluators coerce static values and contexts to be respectively dynamic values and dynamic con texts when they encounter a clash This is acceptable if source programs are rst order and values are either fully static or fully dynamic However these coercions are exces sive for higher order programs with partially static values and contexts Lacking better interface between higher order and dy namic one often must modify one s source programs to im prove their binding times and thus to make them special ize better Jones Gomard and Sestoft Section list eta expansion as an e ective binding time improvement but give only a brief idea of why it works To characterize the e ect of eta expansion we will use the term dynamize with the meaning make dynamic In the following section we explain how eta redexes prevent a binding time analysis from dynamizing static values in dynamic contexts and dynamizing static contexts around dynamic values when the values are higher order Preventing static values and contexts from being dynamized improves the annota tion in case the static values are used elsewhere or in case other static values may also occur in the same context In Section we present two binding time analyses that insert eta redexes automatically and we illustrate them with two continuation based program transformations Section out lines the counterpart of eta expansion for partially static data structures After a comparison with related work we conclude The essence of eta expansion We show three examples where a number occurs both in a static and in a dynamic context a higher order value occurs both in a static and in a dynamic context and a function is applied to both a static and a dynamic higher order argument After the examples we summarize why eta expansion improves binding times given a monovariant binding time analysis We use pronounced apply to denote ap plications and we abbreviate e e e with e e e and e x e with e x e Reminder eta expanding a higher order expression e yields the expression v e v where v does not occur free in e First order static values in dynamic contexts The following expression is partially evaluated in a context where y is dynamic

برای دانلود رایگان متن کامل این مقاله و بیش از 32 میلیون مقاله دیگر ابتدا ثبت نام کنید

ثبت نام

اگر عضو سایت هستید لطفا وارد حساب کاربری خود شوید

منابع مشابه

Eta-Redexes in Partial Evaluation

Source-program modifications can make a partial evaluator yield dramatically better results. For example, eta-redexes can preserve static data flow by acting as an interface between values and contexts. This note presents a type-based explanation of what eta-expansion achieves, why it works, and how it can be automated. This leads to a unified view of various source-code improvements, including...

متن کامل

oes T he T rick ( R evised V ersion ) BRICS Basic Research in Computer Science Eta - Expansion Does The Trick ( Revised

Partial-evaluation folklore has it that massaging one’s source programs can make them specialize better. In Jones, Gomard, and Sestoft’s recent textbook, a whole chapter is dedicated to listing such “binding-time improvements”: nonstandard use of continuationpassing style, eta-expansion, and a popular transformation called “The Trick”. We provide a unified view of these binding-time improvement...

متن کامل

Application of the new extended (G'/G) -expansion method to find exact solutions for nonlinear partial differential equation

In recent years, numerous approaches have been utilized for finding the exact solutions to nonlinear partial differential equations. One such method is known as the new extended (G'/G)-expansion method and was proposed by Roshid et al. In this paper, we apply this method and achieve exact solutions to nonlinear partial differential equations (NLPDEs), namely the Benjamin-Ono equation. It is est...

متن کامل

The essence of knowledge management in the air transportation sector

With the modern development and increasing competitiveness of air transport business processes, the management of knowledge is essential most especially for air transport managers. This controls compounded phases of the organization which begins with the fabrication of organisational strategy towards value creation and improving customers` experience. This study was to explore the review on the...

متن کامل

Application of the tan(phi/2)-expansion method for solving some partial differential equations

In this paper, the improved  -expansion method is proposed to solve the Kundu–Eckhaus equation and Gerdjikov–Ivanov model. The applied method are analytical methods to obtaining the exact solutions of nonlinear equations. Here, the aforementioned methods are used for constructing the soliton, periodic, rational, singular and solitary wave solutions for solving some equations. We obtained furthe...

متن کامل

ذخیره در منابع من


  با ذخیره ی این منبع در منابع من، دسترسی به آن را برای استفاده های بعدی آسان تر کنید

عنوان ژورنال:
  • Lisp and Symbolic Computation

دوره 8  شماره 

صفحات  -

تاریخ انتشار 1994